﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace University.Workshop.Model
{
    [Table("Cistern")]
    public class Cistern
    {
        [Key]
        public string LicencePlate { get; set; }

        public int Capacity { get; set; }
        public bool IsActive { get; set; }

        [ForeignKey("Person")]
        public string DriverId { get; set; }

        public virtual Person Person { get; set; }

        [NotMapped]
        public bool VisibilityButtonDisable
        {
            get { return (IsActive); }
        }

        [NotMapped]
        public bool VisibilityButtonEnable
        {
            get { return ((!IsActive)); }
        }

        [NotMapped]
        public string EnableString
        {
            get { return IsActive ? "Activo" : "Inactivo"; }
        }

        [NotMapped]
        public string NameDriver
        {
            get
            {
                if (string.IsNullOrEmpty(DriverId))
                    return "(Sin Conductor)";
                    return Person.Names;
            }
        }
        [NotMapped]
        public string LastNameDriver
        {
            get
            {
                if (string.IsNullOrEmpty(DriverId))
                    return "(Sin Conductor)";
                    return Person.LastNames;
            }
        }

    }
}